package com.ziyucoding.springboot.labs.lab4.concurrentdemo.example.publish;

import com.ziyucoding.springboot.labs.lab4.concurrentdemo.annoations.NotRecommend;
import com.ziyucoding.springboot.labs.lab4.concurrentdemo.annoations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

/**
 * 对象溢出
 *
 * @author ziyucoding
 * @date 2022-11-27
 **/
@Slf4j
@NotThreadSafe
@NotRecommend
public class EscapeDemo1 {

    /**
     * 溢出
     */
    private int thisCanBeEscape = 0;

    public EscapeDemo1() {
        new InnerClass();
    }

    /**
     * 内部类
     **/
    private class InnerClass {

        public InnerClass() {
            log.info("{}", EscapeDemo1.this.thisCanBeEscape);
        }

    }

    public static void main(String[] args) {
        new EscapeDemo1();
    }

}
